package com.romotc.qqrobot.webqq.qqInterfaceCall;

import java.util.ArrayList;

import org.json.JSONException;
import org.json.JSONObject;

import com.romotc.qqrobot.bean.QQLogedin;
import com.romotc.scache.httpreq;

public class File_InterCall extends QQInterfaceCall {

	public static final String Key_Must_Input_FileUrl = "FileUrl";

	@Override
	public String buildReqBody(JSONObject reqDataObj, QQLogedin loginQQ)
			throws Exception {
		return null;
	}

	@Override
	public int getLogLevel() {
		return 1001;
	}

	@Override
	public String getReqUrl(JSONObject reqDataObj, QQLogedin loginQQ)
			throws JSONException {
		//http://file1.web.qq.com/v2/1586030808/3664882061/29508/1075/45386/0/0/1/f/49232/%E5%8F%91%E9%80%81%E4%BA%BA.jpg
			//?psessionid=8368046764001d636f6e6e7365727665725f77656271714031302e3133342e362e31333800006a7b000013a8036e0400d8e8885e6d0000000a406c784f6b69705543576d00000028cc0a11340eaf5f82d311381eb0406b2a708d17c79139fae71bec4442904deded2a64786c1f2f8131
		return reqDataObj.getString(Key_Must_Input_FileUrl);
	}

	@Override
	public int getReq_method() {
		return httpreq.REQUEST_GET;
	}

	@Override
	public boolean hasPreCall(QQLogedin loginQQ, JSONObject reqDataObj) {
		return false;
	}

	@Override
	public ArrayList<String> myReqHeaders(int reqBodyLen, QQLogedin loginQQ,JSONObject reqDataObj) {
		ArrayList<String> s = buildReqHeaders(loginQQ,
				"http://web.qq.com/", 
				"file1.web.qq.com");
		s = replaceReqHeaders(s,"Accept", "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8");
		return s;
	}


	@Override
	public JSONObject preCall(QQLogedin loginQQ, JSONObject reqDataObj)
			throws Exception {
		return null;
	}

	
	private static File_InterCall instance;
	public static synchronized File_InterCall getInstance() {
		if(instance == null)
			instance = new File_InterCall();
		return instance;
	}
}
